package com.ruoyi.dgw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dgw.mapper.CowAbnormalMapper;
import com.ruoyi.dgw.domain.CowAbnormal;
import com.ruoyi.dgw.service.ICowAbnormalService;

/**
 * 异常Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-23
 */
@Service
public class CowAbnormalServiceImpl implements ICowAbnormalService 
{
    @Autowired
    private CowAbnormalMapper cowAbnormalMapper;

    /**
     * 查询异常
     * 
     * @param abnormalId 异常主键
     * @return 异常
     */
    @Override
    public CowAbnormal selectCowAbnormalByAbnormalId(String abnormalId)
    {
        return cowAbnormalMapper.selectCowAbnormalByAbnormalId(abnormalId);
    }

    /**
     * 查询异常列表
     * 
     * @param cowAbnormal 异常
     * @return 异常
     */
    @Override
    public List<CowAbnormal> selectCowAbnormalList(CowAbnormal cowAbnormal)
    {
        return cowAbnormalMapper.selectCowAbnormalList(cowAbnormal);
    }

    /**
     * 新增异常
     * 
     * @param cowAbnormal 异常
     * @return 结果
     */
    @Override
    public int insertCowAbnormal(CowAbnormal cowAbnormal)
    {
        cowAbnormal.setCreateTime(DateUtils.getNowDate());
        return cowAbnormalMapper.insertCowAbnormal(cowAbnormal);
    }

    /**
     * 修改异常
     * 
     * @param cowAbnormal 异常
     * @return 结果
     */
    @Override
    public int updateCowAbnormal(CowAbnormal cowAbnormal)
    {
        return cowAbnormalMapper.updateCowAbnormal(cowAbnormal);
    }

    /**
     * 批量删除异常
     * 
     * @param abnormalIds 需要删除的异常主键
     * @return 结果
     */
    @Override
    public int deleteCowAbnormalByAbnormalIds(String[] abnormalIds)
    {
        return cowAbnormalMapper.deleteCowAbnormalByAbnormalIds(abnormalIds);
    }

    /**
     * 删除异常信息
     * 
     * @param abnormalId 异常主键
     * @return 结果
     */
    @Override
    public int deleteCowAbnormalByAbnormalId(String abnormalId)
    {
        return cowAbnormalMapper.deleteCowAbnormalByAbnormalId(abnormalId);
    }

    /**
     * 根据耳标查询数据
     *
     * @param earNumber
     */
    @Override
    public CowAbnormal selectCowAbnormalEarNumber(String earNumber) {
        return cowAbnormalMapper.selectCowAbnormalEarNumber(earNumber);
    }
}
